package com.xiaochong.tir.apiservice;

import com.xc.logclient.utils.LogTrace;
import com.xiaochong.service.common.CommonBase;
import com.xiaochong.tir.apiservice.component.*;
import com.xiaochong.tir.apiservice.util.SpringContextUtil;
import com.xiaochong.tir.common.util.AkkaParamUtils;
import com.xiaochong.tir.common.util.AkkaRouterUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * Created by cx on 2018/4/24.
 */
@SpringBootApplication
@MapperScan(ApiServiceApp.BASE_PACKAGE)
@EnableAutoConfiguration
@ServletComponentScan
@ComponentScan({ApiServiceApp.BASE_PACKAGE, LogTrace.BASE_PACKAGE,CommonBase.BASE_PKG})
@EnableScheduling
@EnableAsync
public class ApiServiceApp {
    public static final String BASE_PACKAGE = "com.xiaochong";
    public static void main(String[] args) {
        ApplicationContext applicationContext  = SpringApplication.run(ApiServiceApp.class, args);
        SpringContextUtil.setApplicationContext(applicationContext);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_MORE_THAN_PERCENTAGE_SIX, AkkaMoreThanPercentageSix.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_DIAGNOSIS_MARKET_PERFORMANCE_INDEX, AkkaDiagnosisMarketPerformanceIndex.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_COMPREHENSIVE_ANALYSIS, AkkaComprehensiveAnalysis.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_CONCEPT_INDEX, AkkaConceptIndex.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_COIN_RANK, AkkaCoinRank.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_DIAGNOSIS_SCORE, AkkaDiagnosisScore.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_DIAGNOSIS_PRESSURE_SUPPORTE, AkkaDiagnosisPressureSupporte.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_LONG_SHORT_TREND, AkkaLongShortTrend.class);
        AkkaRouterUtils.registerAsync(AkkaParamUtils.AKKA_DIAGNOSIS_AVERAGE_COST, AkkaDiagnosisAverageCost.class);


    }
}
